package com.onland.dfish.controller;

import com.onland.dfish.entity.Reply;
import com.onland.dfish.entity.Users;
import com.onland.dfish.service.IReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("reply")
public class ReplyController{
    @Autowired
    private IReplyService replyService;

    /**
     * 添加回复
     * @param reply
     * @return
     */
    @PostMapping("add")
    public String addReply(Reply reply){
        int result=replyService.insert(reply);
        return "redirect:/user/play_video.jsp";
    }
    public String queryRely(int commentId, Model m){
        List<Reply> usersList=replyService.queryRely(commentId);
        m.addAttribute("usersList",usersList);
        return "/user/play_video.jsp";
    }

}
